import { ApiProperty, PickType } from '@nestjs/swagger';
import { IsNotEmpty } from 'class-validator';

class ArticleDto {
  @ApiProperty({ description: '文章Id' })
  @IsNotEmpty({ message: '文章Id不能为空' })
  fId: string;

  @ApiProperty({ description: '文章标题' })
  @IsNotEmpty({ message: '文章标题不能为空' })
  fTitle: string;

  @ApiProperty({ description: '作者' })
  @IsNotEmpty({ message: '作者不能为空' })
  fAuthor: string;

  @ApiProperty({ description: '文章内容' })
  fContent: string;

  @ApiProperty({ description: '文章类型' })
  @IsNotEmpty({ message: '文章类型不能为空' })
  fTypeId: number;
}

class AddArticleDto extends PickType(ArticleDto, [
  'fTitle',
  'fAuthor',
  'fContent',
  'fTypeId',
]) {}

class GetArticleByIdDto extends PickType(ArticleDto, ['fId']) {}

export { AddArticleDto, GetArticleByIdDto };
